<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .father {
            width: 240px;
            height: 350px;
            background-color: pink;
        }
        
        .son {
            width: 200px;
            height: 200px;
            background-color: aquamarine;
        }
    </style>
</head>

<body>
    <div class="father">
        <div class="son"></div>
    </div>
    <script>
        //1.捕获阶段，从上往下执行，document->html->body->father->son
        var son = document.querySelector('.son');
        son.addEventListener('click', function() {
            alert('son');
        }, true);
        var father = document.querySelector('.father');
        father.addEventListener('click', function() {
            alert('father');
        }, true);
        //2.冒泡阶段
        //若第三个参数是false 从下往上执行 son->father->body->html->document
        var son = document.querySelector('.son');
        son.addEventListener('click', function() {
            alert('我在一点点进步');
        }, false);
        var father = document.querySelector('.father');
        father.addEventListener('click', function() {
            alert('你是最棒的');
        }, false);
    </script>
</body>

</html>